unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FR_Class, StdCtrls;

type
  TFormMain = class(TForm)
    frCompositeReport1: TfrCompositeReport;
    Button1: TButton;
    frReport1: TfrReport;
    frReport2: TfrReport;
    Button2: TButton;
    frReport3: TfrReport;
    Label1: TLabel;
    Button3: TButton;
    Button4: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
    FPath : String;
  public
    { Public declarations }
  end;

var
  FormMain: TFormMain;

implementation

{$R *.dfm}

procedure TFormMain.Button1Click(Sender: TObject);
begin
  frReport1.LoadFromFile(FPath+'\1.frf');
  frReport2.LoadFromFile(FPath+'\2.frf');

  frCompositeReport1.Clear;
  frCompositeReport1.Reports.Add(frReport1);
  frCompositeReport1.Reports.Add(frReport2);
  frCompositeReport1.PrepareReport;
//  frCompositeReport1.SaveToFile('c:\aaa.frf');
  frCompositeReport1.ShowReport;
//  frCompositeReport1.DesignReport;
end;

procedure TFormMain.FormCreate(Sender: TObject);
begin
  FPath := ExtractFilepath(Application.ExeName);
end;

procedure TFormMain.Button2Click(Sender: TObject);
begin
  frReport3.LoadFromFile(FPath+'\3.frf');
  frReport3.PrepareReport;
//  frReport3.SaveToFile('c:\a3.frf');
  frReport3.ShowReport;
end;

procedure TFormMain.Button3Click(Sender: TObject);
begin
  frReport1.LoadFromFile(FPath+'\1.frf');
  frReport2.LoadFromFile(FPath+'\2.frf');

  frCompositeReport1.Clear;
  frCompositeReport1.Reports.Add(frReport1);
  frCompositeReport1.Reports.Add(frReport2);
//  frCompositeReport1.SaveToFile('c:\aaa.frf');
  frCompositeReport1.PrepareReport;
  frCompositeReport1.PrintPreparedReportDlg;
//  frCompositeReport1.PrintPreparedReport('', 1, True, frAll);
end;

procedure TFormMain.Button4Click(Sender: TObject);
begin
  frReport3.LoadFromFile(FPath+'\3.frf');
//  frReport3.SaveToFile('c:\a3.frf');
  frReport3.PrepareReport;
  frReport3.PrintPreparedReportDlg;
  //frReport3.PrintPreparedReport('', 1, True, frAll);
end;

end.
